#!/bin/bash
#this is a cmdlet to list all mysql logs
let="$count=0"
for myfile in /usr/local/mysql/var/mysql-bin.0*
do
	echo $myfile
let "count=$count+1"
done
echo "total $count files in date()"
let "count=$count-3"

let "$num=1"
for myfile in /usr/local/mysql/var/mysql-bin.0*
do
let "num=$num+1"
	if [ $num -lt $count ]
	then
	rm -f $myfile
	date >>/data/shlog.txt
        echo "delete file $myfile ">>/data/shlog.txt
	else
	echo "$num in files already."
	fi

done
